home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 April: Mac OS SDK / Dev.CD Apr 96 SDK / Dev.CD Apr 96 SDK2.toast / Development Kits (Disc 2) / ScriptX / Draggable ScriptX Folders / utils / DTK / source / DIRIMP_SX / dirimp.sx < prev    next >
Encoding:
Text File  |  1995-12-12  |  1.6 KB  |  63 lines  |  [TEXT/ttxt]

  1. class DirectorImporter (Importer)
  2. end
  3.  
  4. method init self {class DirectorImporter} #rest args -> (
  5.  args := merge args #(@mediaCategory,@Metaphor,@inputMediaType,@Director,@outputMediaType,@ScorePlayer)
  6.  apply nextMethod self args
  7. )
  8.  
  9. method importFromStream self {class DirectorImporter} source #rest args  \
  10.     #key container: \
  11.     outputMediaType: ->
  12. (
  13.     
  14.     local theDTK
  15.     local theScoreTranslator
  16.         
  17.     -- Make a DTK for the chosen file
  18.     theDTK := new DTK directorFileName:source container:container
  19.     
  20.     -- This translator converts castmembers
  21.     theDTK.castTranslator := new ScorePlayerCastTranslator
  22.  
  23.     if outputMediaType = @castList then
  24.     (
  25.         translateDirector theDTK
  26.         return theDTK.castList
  27.     ) else
  28.     (
  29.         -- We want a ScorePlayer back
  30.         theScoreTranslator := new ScorePlayerScoreTranslator
  31.         theDTK.scoreTranslator := theScoreTranslator
  32.  
  33.         translateDirector theDTK
  34.  
  35.         theScoreTranslator.scorePlayer.brushCache := theDTK.castTranslator.brushCache
  36.         return theScoreTranslator.scorePlayer
  37.     )
  38. )
  39.  
  40. function registerDirectorImporter ->
  41. (
  42.     local directorImporterRep
  43.     local anArray
  44.     local aPropertyCollection
  45.     
  46.     directorImporterRep := new ClassRepresentative \
  47.                                 owner:@OwnerSubstrate \
  48.                                 type:@TypeGestalt \
  49.                                 subtype: @subTypeImportExport \
  50.                                 version: "1.0" \
  51.                                 vendor: @VendorKaleida \
  52.                                 free: false
  53.                                 
  54.     addProperty directorImporterRep @mediaCategoryProp @Metaphor
  55.     addProperty directorImporterRep @mediaInputTypeProp @Director
  56.  
  57.     anArray := #(@ScorePlayer, @CastList)
  58.     aPropertyCollection := newPropertyCollection Manager anArray
  59.     addProperty directorImporterRep @mediaOutputTypeProp aPropertyCollection
  60.     
  61.     setClass directorImporterRep DirectorImporter
  62. )
  63.